package com.own.business.exam.entity.bo;


import com.own.business.exam.entity.po.ExamRuleQuestion;
import com.own.component.common.base.entity.BaseBo;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.math.BigDecimal;

/**
 * ExamRuleQuestionBo
 *
 * @author 陈学礼 （你是一段成熟的代码，要学会自己改bug）
 * @version 4.0.0
 * @date 2021/05/18 14:43:47
 * @since 4.0.0
 */
@ApiModel("考试规则题目表" + ConstantBeanSuffix.BO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class ExamRuleQuestionBo extends BaseBo<ExamRuleQuestion> {

    @ApiModelProperty("规则id")
    private Long ruleId;

    @ApiModelProperty("题目id")
    private Long questionId;

    @ApiModelProperty("题目分数")
    private BigDecimal score;

    @ApiModelProperty("答对一部分的分数")
    private BigDecimal someRightScore;

    /**
     * 转持久化对象
     *
     * @param entity 原持久化对象
     * @return 持久化对象
     */
    @Override
    public ExamRuleQuestion toPo(ExamRuleQuestion entity) {
        if (entity == null) {
            entity = new ExamRuleQuestion();
        }
        entity.setFkRuleId(ruleId);
        entity.setFkQuestionId(questionId);
        entity.setScore(score);
        entity.setSomeRightScore(someRightScore);
        return super.toPo(entity);
    }

}
